import fetch from '@/api'


// 查询客户分页
export function getCustomList(params) {
    return fetch({
        method: 'get',
        url: '/pcCustoms',
        params
    })
}

// 查询结算单位
export function getAccountUnit(params) {
    return fetch({
        method: 'get',
        url: '/customs/getAccountUnit',
        params
    })
}

// 获取船代列表
export function getListShip(params) {
    return fetch({
        method: 'get',
        url: '/customs',
        params
    })
}

// 根据登录用户获取船代列表(2018-11-30)
export function getCustomListShip(params) {
    return fetch({
        method: 'get',
        url: '/customs/getLoginCustomers',
        params
    })
}

// 新增客户
export function addCustomer(data) {
    return fetch({
        method: 'post',
        url: `/pcCustoms`,
        data
    })
}

// 编辑客户信息
export function updateCustomer(id, data) {
    return fetch({
        method: 'put',
        url: `/pcCustoms/${id}`,
        data,
    })
}

// 查询客户信息详情
export function getCustomDetail(id) {
    return fetch({
        method: 'get',
        url: `/pcCustoms/${id}`
    })
}

// 根据ID删除客户
export function delCustomer(id) {
    return fetch({
        method: 'delete',
        url: `/pcCustoms/${id}`,
    })
}


// 客户登陆账户
export function getCustomAccs(params) {
    return fetch({
        method: 'get',
        url: '/customerAccount',
        params
    })
}

// 客户登陆账户详情
export function getCustomAcc(id) {
    return fetch({
        method: 'get',
        url: `/customerAccount/${id}`
    })
}

// 新增客户登陆账户
export function addCustomAcc(data) {
    return fetch({
        method: 'post',
        url: '/customerAccount',
        data
    })
}

// 编辑登陆账户
export function aupdateCustomAcc(id,data) {
    return fetch({
        method: 'put',
        url: `/customerAccount/${id}`,
        data
    })
}

// 删除登陆账户
export function delCustomAcc(id) {
    return fetch({
        method: 'delete',
        url: `/customerAccount/${id}`
    })
}

// 重置密码
export function resetCusPassword(id,data) {
    return fetch({
        method: 'put',
        url: `/customerAccount/${id}/password`,
        data
    })
}